package org.mozilla.javascript.tools.shell;

import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class RhinoShellTest {

    @Test
    public void should_run_test() {

        ByteArrayOutputStream under = new ByteArrayOutputStream();

        PrintStream output = new PrintStream(under);

        RhinoShell shell = new RhinoShell(output, output);
        shell.runTest("load('/home/isaachan/IdeaProjects/jspectest/calculator.js');\n" +
                "load('/home/isaachan/opensrc/JSpecPlugin/rhinoextension/js/jspec.js');\n" +
                "JSpec.exec('/home/isaachan/IdeaProjects/jspectest/calculatortest.js').run({reporter: JSpec.reporters.Terminal}).report();");

        byte[] bytes = under.toByteArray();
        String s = new String(bytes);
        System.out.println("=================");
        System.out.println(s);
        System.out.println("=================");
    }

}
